﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace sy3_4_2_
{
    internal class Truck:Vehicle 
    {
        private float maxLoad, oilPerKm;

        public void SetVehicle(int wheels, float weight, float maxLoad, float oilPerKm)
        {
            base.SetVehicle(wheels, weight);
            this.maxLoad = maxLoad;
            this.oilPerKm = oilPerKm;
        }

        public bool Overload(float nowLoad)
        {
            return nowLoad > maxLoad;
        }

        public float OilConsumption(float runKm)
        {
            return runKm * oilPerKm;
        }

        public override void GetVehicle()
        {
            MessageBox.Show($"车轮数: {wheels}\n车重量: {weight}\n载重量: {maxLoad}\n每公里耗油: {oilPerKm}");
        }
    }
}
